import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import router from './router'
import App from './App.vue'
import './styles/design-system.css'
import './assets/styles/main.css'
import './assets/styles/image-viewer-fix.css'
import './assets/styles/image-viewer-override.css'
import { fixImageViewerZIndex } from './utils/fixImageViewerZIndex'

const app = createApp(App)
const pinia = createPinia()

// 启动图片查看器 z-index 修复
fixImageViewerZIndex()

// 注册所有 Element Plus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(pinia)
app.use(router)
app.use(ElementPlus, {
  locale: zhCn,
  zIndex: 10000  // 设置 Element Plus 全局 z-index 起始值
})

app.mount('#app')
